﻿<UserControl x:Class="ModernUILogViewer.Content.ContentProcessing"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"                
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"                
             xmlns:view="clr-namespace:ModernUILogViewer.View"
             mc:Ignorable="d" 
             d:DesignHeight="150" d:DesignWidth="300">
    <Grid Style="{StaticResource ContentRoot}">
        <StackPanel HorizontalAlignment="Center">
            <TextBlock HorizontalAlignment="Center" >
                <Run Text="Processing file: " />
                <Run Text="{Binding CurrentProcessedFilename, Mode=OneWay}" />
            </TextBlock>
            <TextBlock HorizontalAlignment="Center" TextAlignment="Right">
                <Run Text="Entries: " />
                <Run Text="{Binding EntriesCount, Mode=OneWay}" />
            </TextBlock>
            <ProgressBar Value="{Binding BytesRead, Mode=OneWay}" Maximum="{Binding FileSize, Mode=OneWay}" Height="30" Margin="{StaticResource DefaultTopMargin}" />
            <Button Command="{Binding CancelProcessFile}" Width="80" Content="Cancel" Margin="{StaticResource DefaultTopMargin}"></Button>
        </StackPanel>
    </Grid>
    
    <i:Interaction.Triggers>
        <ei:DataTrigger Binding="{Binding IsProcessing}" Value="False">
            <i:InvokeCommandAction Command="{x:Static view:ViewCommands.CloseSelfWindow}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mui:ModernDialog}}}" />
        </ei:DataTrigger>        
    </i:Interaction.Triggers>
    
</UserControl>
